<%@ page import="java.util.List" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="com.wn.com.wn.bean.User" %><%--
  Created by IntelliJ IDEA.
  User: scott
  Date: 0030
  Time: 10:56
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt" %>
<html>
<head>
    <title>Title</title>
</head>
<body>

<%
    List<User> list = new ArrayList();

    User u1 = new User();
    u1.setUsername("郭靖");
    u1.setPassword("123");


    User u2 = new User();
    u2.setUsername("黄药师");
    u2.setPassword("123");


    User u3 = new User();
    u3.setUsername("黄蓉");
    u3.setPassword("123");
    list.add(u1);
    list.add(u2);
    list.add(u3);

    pageContext.setAttribute("users",list);
%>
<%--
        c:forEach   循环标签
        items="key"    拿到 集合
        var       集合中的元素
--%>
<c:forEach items="${users}" var="u">
    ${u}
</c:forEach>

<table border="1" cellspacing="0">
    <tr>
        <td>用户名</td>
        <td>密码</td>
    </tr>

    <c:forEach items="${users}" var="u">
      <tr>
          <td>${u.username}</td>
          <td>${u.password}</td>
      </tr>
    </c:forEach>

</table>

</body>
</html>
